for _ in range(int(input())):
n=int(input())
a1,b1,a2,b2,a3,b3=map(int,input().split())
x=sorted([a1,a2,a3])
y=sorted([b1,b2,b3])
x1,y1=map(int,input().split())
if ({x[1],y[1]} <= {1,n}):
print(["No","Yes"][(x1-x[1])==0 or (y1-y[1])==0])
else :
print(["No","Yes"][(x1+x[1])%2==0 or (y1+y[1])%2==0])
#include <bits/stdc++.h>
using namespace std;
int main ()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int qq;
cin>>qq;
while (qq--) {
int n,ans=-1;
cin>>n;
pair<int,int>c[3];
for (int i=0;i<3;i++) {
cin>>c[i].first>>c[i].second;
}
pair<int,int>m,v,g;
cin>>g.first>>g.second;
if (c[0].first==c[1].first) {
m.first=c[2].first;
v.first=c[0].first;
}
else if (c[0].first==c[2].first) {
m.first=c[1].first;
v.first=c[0].first;
}
else {
m.first=c[0].first;
v.first=c[1].first;
}
if (c[0].second==c[1].second) {
m.second=c[2].second;
v.second=c[0].second;
}
else if (c[0].second==c[2].second) {
m.second=c[1].second;
v.second=c[0].second;
}
else {
m.second=c[0].second;
v.second=c[1].second;
} //what
if (((v.first==1)||(v.first==n))&&((v.second==1)||(v.second==n))) {
if (((m.first-v.first==1)||(m.first-v.first==-1))&&((m.second-v.second==1)||(m.second-v.second==-1))) {
if((v.first==g.first)||(v.second==g.second)){
ans=1;
}
else {
ans=0;
}
}
}
if (ans==-1) {
if (!((g.first-m.first)%2)&&!((g.second-m.second)%2)) {
ans=0;
}
else {
ans=1;
}
}
cout<<(ans?"YES\n":"NO\n");
}
return 0;
}
485A - Factory | 628A - Tennis Tournament |
1436B - Prime Square | 1707B - Difference Array |
1422C - Bargain | 1611F - ATM and Students |
660A - Co-prime Array | 1692F - 3SUM |
1470A - Strange Birthday Party | 190D - Non-Secret Cypher |
1721B - Deadly Laser | 1721C - Min-Max Array Transformation |
1721A - Image | 1180C - Valeriy and Deque |
557A - Ilya and Diplomas | 1037D - Valid BFS |
1144F - Graph Without Long Directed Paths | 1228A - Distinct Digits |
355B - Vasya and Public Transport | 1230A - Dawid and Bags of Candies |
1530A - Binary Decimal | 1472D - Even-Odd Game |
441C - Valera and Tubes | 1328E - Tree Queries |
265A - Colorful Stones (Simplified Edition) | 296A - Yaroslav and Permutations |
967B - Watering System | 152A - Marks |
1398A - Bad Triangle | 137A - Postcards and photos |